﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using He.Common;

namespace He.Web.manage.member
{
    public partial class edit_pwd : He.Web.UI.Manage
    {
        private int id = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.QueryString["id"] as string, out this.id))
            {
                JscriptMsg(350, 230, "错误提示", "<b>出现错误啦！</b>您要修改的信息不存在或参数不正确。", "back", "Error");
                return;
            }
            if (!this.Page.IsPostBack)
            {
                chkLoginLevel("editmember");
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            string url = CookieHelper.Get("LastListUrl");
            if (string.IsNullOrEmpty(url))
            {
                url = Request.RawUrl;
            }

            BLL.member bll = new BLL.member();
            Model.member model = bll.GetModel(id);
            model.user_pwd = CryptoHelper.DESEncrypt(txtUserPwd.Text.Trim());
            bll.Update(model);
            SaveLogs(string.Format("[会员管理]修改密码:{0}", model.user_name));
            JscriptPrint("修改成功啦！", url, "Success");
        }
    }
}